<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>小游戏中心 - 在线畅玩</title>
    <link href="https://cdn.tailwindcss.com" rel="stylesheet">
    <link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link rel="stylesheet" href="css/style.css">
</head>
<body class="bg-gradient-to-br from-purple-400 via-pink-500 to-red-500 min-h-screen">
    <div class="container mx-auto px-4 py-8">
        <!-- 头部 -->
        <header class="text-center mb-12">
            <h1 class="text-5xl font-bold text-white mb-4 drop-shadow-lg">
                <i class="fas fa-gamepad mr-3"></i>小游戏中心
            </h1>
            <p class="text-xl text-white opacity-90">无需注册，即点即玩！</p>
        </header>

        <!-- 游戏列表 -->
        <div class="grid md:grid-cols-3 gap-8 mb-12">
            <!-- 贪吃蛇 -->
            <div class="bg-white rounded-2xl shadow-2xl p-6 transform hover:scale-105 transition-transform">
                <div class="text-center">
                    <div class="w-24 h-24 bg-green-500 rounded-full mx-auto mb-4 flex items-center justify-center">
                        <i class="fas fa-snake text-white text-3xl"></i>
                    </div>
                    <h3 class="text-2xl font-bold text-gray-800 mb-2">贪吃蛇</h3>
                    <p class="text-gray-600 mb-4">经典贪吃蛇游戏，挑战高分！</p>
                    <button onclick="openGame('snake')" class="bg-green-500 hover:bg-green-600 text-white px-6 py-3 rounded-lg font-semibold transition-colors">
                        <i class="fas fa-play mr-2"></i>开始游戏
                    </button>
                </div>
            </div>

            <!-- 打地鼠 -->
            <div class="bg-white rounded-2xl shadow-2xl p-6 transform hover:scale-105 transition-transform">
                <div class="text-center">
                    <div class="w-24 h-24 bg-yellow-500 rounded-full mx-auto mb-4 flex items-center justify-center">
                        <i class="fas fa-hammer text-white text-3xl"></i>
                    </div>
                    <h3 class="text-2xl font-bold text-gray-800 mb-2">打地鼠</h3>
                    <p class="text-gray-600 mb-4">快速反应，击中出现的地鼠！</p>
                    <button onclick="openGame('whack')" class="bg-yellow-500 hover:bg-yellow-600 text-white px-6 py-3 rounded-lg font-semibold transition-colors">
                        <i class="fas fa-play mr-2"></i>开始游戏
                    </button>
                </div>
            </div>

            <!-- 记忆翻牌 -->
            <div class="bg-white rounded-2xl shadow-2xl p-6 transform hover:scale-105 transition-transform">
                <div class="text-center">
                    <div class="w-24 h-24 bg-purple-500 rounded-full mx-auto mb-4 flex items-center justify-center">
                        <i class="fas fa-memory text-white text-3xl"></i>
                    </div>
                    <h3 class="text-2xl font-bold text-gray-800 mb-2">记忆翻牌</h3>
                    <p class="text-gray-600 mb-4">考验记忆力，找出相同的牌！</p>
                    <button onclick="openGame('memory')" class="bg-purple-500 hover:bg-purple-600 text-white px-6 py-3 rounded-lg font-semibold transition-colors">
                        <i class="fas fa-play mr-2"></i>开始游戏
                    </button>
                </div>
            </div>
        </div>

        <!-- 排行榜 -->
        <div class="bg-white rounded-2xl shadow-2xl p-6">
            <h2 class="text-3xl font-bold text-gray-800 mb-6 text-center">
                <i class="fas fa-trophy mr-2 text-yellow-500"></i>排行榜
            </h2>
            
            <div class="flex justify-center mb-6">
                <select id="gameSelect" class="px-4 py-2 border rounded-lg" onchange="loadLeaderboard()">
                    <option value="snake">贪吃蛇</option>
                    <option value="whack">打地鼠</option>
                    <option value="memory">记忆翻牌</option>
                </select>
            </div>
            
            <div id="leaderboard" class="max-w-md mx-auto">
                <div class="text-center text-gray-500">加载中...</div>
            </div>
        </div>
    </div>

    <!-- 游戏模态框 -->
    <div id="gameModal" class="fixed inset-0 bg-black bg-opacity-50 hidden items-center justify-center z-50">
        <div class="bg-white rounded-2xl p-6 max-w-2xl w-full mx-4 max-h-[90vh] overflow-y-auto">
            <div class="flex justify-between items-center mb-4">
                <h3 id="gameTitle" class="text-2xl font-bold"></h3>
                <button onclick="closeGame()" class="text-gray-500 hover:text-gray-700">
                    <i class="fas fa-times text-2xl"></i>
                </button>
            </div>
            <div id="gameContent"></div>
        </div>
    </div>

    <script src="js/main.js"></script>
</body>
</html>
